import request from '@/plugin/axios'
const apiPrefix = '${cfg.apiUrlPrefix}/${table.entityPath}'

export function GetPage (query) {
  return request({
    url: apiPrefix + '/page',
    method: 'get',
    params: query
  })
}

export function GetList (query) {
  return request({
    url: apiPrefix,
    method: 'get',
    params: query
  })
}

export function AddObj (obj) {
  return request({
    url: apiPrefix,
    method: 'post',
    data: obj
  })
}

export function UpdateObj (obj) {
  return request({
    url: apiPrefix',
    method: 'put',
    data: obj
  })
}

export function DelObj (id) {
  return request({
    url: apiPrefix + '/delete/' + id,
    method: 'delete',
  })
}

export function BatchDel (ids) {
  id = id.toString()
  return request({
    url: apiPrefix + '/delete',
    method: 'delete',
    params: { ids }
  })
}

export function GetObj (id) {
  return request({
    url: apiPrefix + '/' + id,
    method: 'get',
    params: { id }
  })
}